#include <iostream>
using namespace std;

class character {

protected:
  int health;
  int meleStrength;
  int magicStrength;
  int moveSpeed;

public:
  character() {
    health = 100;
    cout << "in character constructor" << endl;
  }
  // watch what happens when you don't make this virtual
  virtual ~character() {
    cout << "in character destructor" << endl;
  }
  void attack() {
    cout << "standard mele attack" << " " << endl;
  } 
  void seeHealth() {cout << "Health=" << health << endl;}
};

class sorcerer : virtual public character {
protected:

public:
  sorcerer() {
    cout << "in sorcerer constructor" << endl;
    meleStrength = 1;
    magicStrength = 10;
    moveSpeed = 4;
 }
  ~sorcerer() {
    cout << "in sorcerer destructor" << endl;
  }

  virtual void attack() {
    cout << "special attack" << " " << endl;
  }

};

class footsoldier : virtual public character {

protected:
public:
  footsoldier() {
    cout << "in footsoldier constructor" << endl;
    meleStrength = 10;
    magicStrength = 1;
    moveSpeed = 7;
  }

  ~footsoldier() {
    cout << "in footsoldier destructor" << endl;
  }

};

class hybrid : public footsoldier, sorcerer {
public:
  hybrid() {
    // footsoldier then sorcerer, then finally hybrid's constructor is called
    cout << "Hybrid strength: " << meleStrength << " " << endl;
  }
  ~hybrid() {
    cout << "in hybrid destructor" << endl;
  }
};

int main()
{
  character *myCharacters[4];
  myCharacters[0] = new sorcerer;
  myCharacters[1] = new footsoldier;
  myCharacters[2] = new character;
  myCharacters[3] = new hybrid;

  cout << endl;
  for (int i = 0; i < 4; i++) {
    myCharacters[i]->attack();
    myCharacters[i]->seeHealth();
    cout << endl;
  }

  for (int i = 0; i < 4; i++) {
    delete myCharacters[i];
  }
}


